from Base import Asset

from DataFeeder.QueryQuote import *
from DataFeeder.QueryCurrency import query_stock_currency

class Stock(Asset):

	def npv_in_local_currency(self, ref_time, quote_type):
			
		return QuoteRegister().get_stock_quote(ref_time, self.ticker(), quote_type)
		
	@staticmethod
	def type_name():
		return "STOCK"
		
	def __init__(self, ticker):
		self.stock_ticker = ticker
		self.stock_currency = query_stock_currency(ticker)
		
	def ticker(self):
		return self.stock_ticker
	
	def currency(self):
		return self.stock_currency	
			
	def __hash__(self):
		return hash(self.stock_ticker)
		
	def __eq__(self, other):
		return other and self.ticker() == other.ticker()
